<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePatentFilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('patent_files', function (Blueprint $table) {
            $table->id();
            $table->string('patent_sn',20)->comment('专利申请号');
            $table->integer('user_id')->comment('上传人ID');
            $table->string('name')->comment('名称');
            $table->string('path')->comment('路径');
            $table->string('slug',20)->comment('标识');
            $table->string('mime',50)->nullable()->comment('文件类型');
            $table->string('size', 20)->default(0)->comment('文件大小');
            $table->timestamps();

            $table->index('patent_sn');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('patent_files');
    }
}
